import glob
import os
from datetime import datetime
'''
conftest.py中fixture的scope值为session时使用该脚本测试
'''


def get_now():
    return datetime.now().strftime("%D %T")

if __name__ == "__main__":
    cwd = os.path.dirname(os.path.abspath(__file__))
    os.chdir(cwd)
    files_name = glob.glob("test_*.py")
    time_tail = '='*5 + get_now()
    for file_name in files_name:
        print(f"test file: {file_name}{time_tail}")
        os.system(f"pytest --disable-warnings {file_name}")

    print(f"all test finished{time_tail}")